<?php
//ini_set('display_errors', 0);
//error_reporting(0);
set_time_limit(220);


//Line Break
if (PHP_SAPI === 'cli'){
    //if run from command line
    $br = PHP_EOL;
}
else{
    //if run from browser
    $br = "<br/>";
}

use \Crawler\WebCrawler as WebCrawler;

$crawler = WebCrawler::getInstance();

//Crawler for aplopio
// $crawler->beginCrawl("http://ibongda.vn/ty-le-keo-bong-da-ngoai-hang-anh-s1.sr");

// $aplopio = $crawler->getWebPages();
// print_r($aplopio);
// foreach ($aplopio as $url => $properties) {
//     echo $url . $br;
// }

$data = $crawler->beginCrawRate("http://ibongda.vn/ty-le-keo-bong-da-ngoai-hang-anh-s1.sr");
echo '<pre>';
print_r($data);
$file = fopen("json_tisokeo.txt","w");
fwrite($file,json_encode(array('data'=>$data)));
fclose($file);
//autoload of classes
function __autoload($className) {
    $filename = $className . ".php";
    if (is_readable($filename)) {
        require $filename;
    }
}
